package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.mapper.AdminStudentMapper;
import com.ruoyi.system.domain.AdminStudent;
import com.ruoyi.system.service.IAdminStudentService;
import com.ruoyi.common.core.text.Convert;

/**
 * 学生Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-09
 */
@Service
public class AdminStudentServiceImpl implements IAdminStudentService 
{
    @Autowired
    private AdminStudentMapper adminStudentMapper;

    /**
     * 查询学生
     * 
     * @param studentId 学生ID
     * @return 学生
     */
    @Override
    public AdminStudent selectAdminStudentById(Long studentId)
    {
        return adminStudentMapper.selectAdminStudentById(studentId);
    }

    /**
     * 查询学生列表
     * 
     * @param adminStudent 学生
     * @return 学生
     */
    @Override
    public List<AdminStudent> selectAdminStudentList(AdminStudent adminStudent)
    {
        return adminStudentMapper.selectAdminStudentList(adminStudent);
    }

    /**
     * 新增学生
     * 
     * @param adminStudent 学生
     * @return 结果
     */
    @Override
    public int insertAdminStudent(AdminStudent adminStudent)
    {
        adminStudent.setCreateTime(DateUtils.getNowDate());
        return adminStudentMapper.insertAdminStudent(adminStudent);
    }

    /**
     * 修改学生
     * 
     * @param adminStudent 学生
     * @return 结果
     */
    @Override
    public int updateAdminStudent(AdminStudent adminStudent)
    {
        adminStudent.setUpdateTime(DateUtils.getNowDate());
        return adminStudentMapper.updateAdminStudent(adminStudent);
    }

    /**
     * 删除学生对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminStudentByIds(String ids)
    {
        return adminStudentMapper.deleteAdminStudentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除学生信息
     * 
     * @param studentId 学生ID
     * @return 结果
     */
    @Override
    public int deleteAdminStudentById(Long studentId)
    {
        return adminStudentMapper.deleteAdminStudentById(studentId);
    }
    
    /**
     * 学生状态修改
     * 
     * @param student 学生信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminStudent adminStudent)
    {
        return adminStudentMapper.updateAdminStudent(adminStudent);
    }
}
